package com.shux.kafka.producer;

import org.apache.kafka.common.serialization.Serializer;

/**
 * 描述：
 * 
 * <pre>HISTORY
 * ****************************************************************************
 *  ID   DATE           PERSON          REASON
 *  1    2017年9月25日      Simba.Hua         Create
 * ****************************************************************************
 * props.put("bootstrap.servers", "localhost:9092");
		 props.put("acks", "all");
		 props.put("retries", 0);
		 props.put("batch.size", 16384);
		 props.put("linger.ms", 1);
		 props.put("buffer.memory", 33554432);
		 props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
		 props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
 * </pre>
 * @author Simba.Hua
 */
public class ProducerConfig<K,V> {
	private String kafkaServer;
	private String topic;
	private String transactionalId;
	private String acks;
	private Integer retries;
	private Integer batchSize;
	private Integer lingerMs;
	private Integer bufferMemory;
	private Serializer<K> keySerializer;
	private Serializer<V> valueSerializer;
	
	public ProducerConfig(String kafkaServer,String topic,String transactionalId,Serializer<K> keySerializer,Serializer<V> valueSerializer){
		this.kafkaServer = kafkaServer;
		this.topic = topic;
		this.transactionalId = transactionalId;
		this.acks = "all";
		this.retries = 0;
		this.batchSize = 16384;
		this.lingerMs = 1;
		this.bufferMemory = 33554432;
		this.keySerializer = keySerializer;
		this.valueSerializer = valueSerializer;
		
	}
	
	public ProducerConfig(String kafkaServer,String topic){
		this.kafkaServer = kafkaServer;
		this.topic = topic;
		this.acks = "0";
		this.retries = 0;
		this.batchSize = 16384;
		this.lingerMs = 1;
		this.bufferMemory = 33554432;
		
	}
	
	public String getTopic() {
		return topic;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public String getKafkaServer() {
		return kafkaServer;
	}
	public void setKafkaServer(String kafkaServer) {
		this.kafkaServer = kafkaServer;
	}
	
	public String getTransactionalId() {
		return transactionalId;
	}

	public void setTransactionalId(String transactionalId) {
		this.transactionalId = transactionalId;
	}

	public String getAcks() {
		return acks;
	}
	public void setAcks(String acks) {
		this.acks = acks;
	}
	public Integer getRetries() {
		return retries;
	}
	public void setRetries(Integer retries) {
		this.retries = retries;
	}
	public Integer getBatchSize() {
		return batchSize;
	}
	public void setBatchSize(Integer batchSize) {
		this.batchSize = batchSize;
	}
	public Integer getLingerMs() {
		return lingerMs;
	}
	public void setLingerMs(Integer lingerMs) {
		this.lingerMs = lingerMs;
	}
	public Integer getBufferMemory() {
		return bufferMemory;
	}
	public void setBufferMemory(Integer bufferMemory) {
		this.bufferMemory = bufferMemory;
	}

	public Serializer<K> getKeySerializer() {
		return keySerializer;
	}

	public void setKeySerializer(Serializer<K> keySerializer) {
		this.keySerializer = keySerializer;
	}

	public Serializer<V> getValueSerializer() {
		return valueSerializer;
	}

	public void setValueSerializer(Serializer<V> valueSerializer) {
		this.valueSerializer = valueSerializer;
	}
	
	
}
